import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import(/* webpackChunkName: "home" */ '@/views/home/index.vue'),
    children: [{
      path: '/',
      name: 'index',
      component: () => import(/* webpackChunkName: "index" */ '@/views/home/index/index.vue'),
    }, {
      path: '/car',
      name: 'selectCar',
      component: () => import(/* webpackChunkName: "selectCar" */ '@/views/home/selectCar/index.vue'),
    }]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "home" */ '@/views/login/index.vue')
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import(/* webpackChunkName: "home" */ '@/views/detail/index.vue')
  },
  {
    path: '/car/info/:id',
    name: 'carInfo',
    component: () => import(/* webpackChunkName: "home" */ '@/views/carInfo/index.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
